﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using SQLDB;
using System.Data.SqlClient;

namespace EFFrist
{
    class Program
    {
        static void Main(string[] args)
        {
            #region  EF 请求数据库
            //List<UserInfo> usl = new List<UserInfo>();
            //ef db = new ef();
            //usl = db.getUserInfo();
            #endregion
            DataTable dt = new DataTable();
            string strSql = "Select * from UserInfo";

            dt = SQLDB.SQLDB.GetTable(strSql);
            List<UserInfo> uslstDR = new List<UserInfo>();
            SqlDataReader sr = SQLDB.SQLDB.GetReader(strSql, null, CommandType.Text);
            uslstDR = DBToList<UserInfo>.DataReaderToList(sr);



            UserInfo userList = new UserInfo();
            //DBToList<T> dbt = new DBToList<UserInfo>();
            List<UserInfo> uslst = new List<UserInfo>();
            uslst = DBToList<UserInfo>.DataTableToList(dt);
            ListToSql ls = new ListToSql();
            //int ii = ls.Insert<UserInfo>(uslst[0]);

            //更新测试
            uslst[0].ID = "testUpdate";
            int iiupdate = ls.Update<UserInfo>(uslst[0]);

        }
    }
    public class ef
    {
        hibDBEntities db = new hibDBEntities();
        public List<UserInfo> getUserInfo()
        {

            List<UserInfo> userList = new List<UserInfo>();
            userList = db.UserInfo.ToList();
            return userList;
        }

    }
}
